package com.yonyou.sto.modules.ims.controller;

import com.yonyou.sto.common.api.CommonResult;
import com.yonyou.sto.modules.ims.dto.ImsInvoiceParam;
import com.yonyou.sto.modules.ims.service.ImsInvoiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ：Aegon Targaryen
 * @version ：1.0-SNAPSHOT
 * @date ：Created in 2020/9/27 16:02
 * @description ：悦闻专用接口
 * @modifiedBy ：
 */
@RestController
@RequestMapping("/server/ims/imsInvoice")
@Api(tags = "ImsAcceptController", description = "悦闻专用接口")
public class ImsAcceptController {

    @Resource
    private ImsInvoiceService imsInvoiceService;

    @ApiOperation("接收悦闻推送的收款单内容")
    @RequestMapping(value = "/create", method = RequestMethod.POST)
    public CommonResult create(@RequestBody ImsInvoiceParam imsInvoiceParam) {
        return imsInvoiceService.create(imsInvoiceParam);
    }

    @ApiOperation("接收悦闻推送的撤回单据消息")
    @RequestMapping(value = "/revoke", method = RequestMethod.GET)
    public CommonResult revoke(@RequestParam String billSn) {
        return imsInvoiceService.revoke(billSn);
    }
}
